<?php
/**
 * Created by PhpStorm.
 * User: geyouwen
 * Date: 16/7/7
 * Time: 上午11:17
 */
namespace Superadmin\Controller;

use Think\Controller;

class CacheController extends BaseController
{
    //ajax 清理缓存
    public function clear()
    {
        $path = CACHE_PATH.'/Cache/Superadmin/';
        $this->deleteAll($path);
    }


    function deleteAll($path) {
        $op = dir($path);
        while(false != ($item = $op->read())) {
            if($item == '.' || $item == '..') {
                continue;
            }
            if(is_dir($op->path.'/'.$item)) {
                deleteAll($op->path.'/'.$item);
                rmdir($op->path.'/'.$item);
            } else {
                unlink($op->path.'/'.$item);
            }

        }
    }




}